PostgreSQL pg_wait_sampling pg_wait_sampling_current 视图

1 背景知识

pg_wait_sampling_current 视图 记录当前正在运行所有的进程的等待事件,包括后台进程。

2 查询视图

SELECT * FROM  pg_wait_sampling_current;
pid  | event_type |        event        | queryid 
-------+------------+---------------------+---------
 56337 | Activity   | AutoVacuumMain      |       0
 56339 | Activity   | LogicalLauncherMain |       0
 56338 | Extension  | Extension           |       0
 56333 | Activity   | CheckpointerMain    |       0
 56334 | Activity   | BgWriterHibernate   |       0
 56336 | Activity   | WalWriterMain       |       0
(6 rows)

3 视图详解

Column name Column type Description
pid int4 Id of process
event_type text Name of wait event type
event text Name of wait event
queryid int8 Id of query

4 参考连接

postgrespro/pg_wait_sampling: Sampling based statistics of wait events (github.com)